package com.sxt.bus.controller;

import java.util.List;

import com.sxt.springcloud.bus.GoodsClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


import com.sxt.bus.vo.GoodsVo;
import com.sxt.sys.common.DataGridView;
import com.sxt.sys.common.ResultObj;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author 老雷
 * @since 2019-09-27
 */
@RestController
@RequestMapping("/goods")
public class GoodsController {

	@Autowired
	private GoodsClientService goodsClientService;

	/**
	 * 查询
	 */
	@RequestMapping("loadAllGoods")
	public DataGridView loadAllGoods(GoodsVo goodsVo) {

		return this.goodsClientService.loadAllGoods(goodsVo);
	}

	/**
	 * 添加
	 */
	@RequestMapping("addGoods")
	public ResultObj addGoods(GoodsVo goodsVo) {
		return this.goodsClientService.addGoods(goodsVo);
	}

	/**
	 * 修改
	 */
	@RequestMapping("updateGoods")
	public ResultObj updateGoods(GoodsVo goodsVo) {
		return this.goodsClientService.updateGoods(goodsVo);
	}

	/**
	 * 删除
	 */
	@RequestMapping("deleteGoods")
	public ResultObj deleteGoods(Integer id,String goodsimg) {
		return this.goodsClientService.deleteGoods(id,goodsimg);
	}
	
	/**
	 * 加载所有可用的供应商
	 */
	@RequestMapping("loadAllGoodsForSelect")
	public DataGridView loadAllGoodsForSelect() {
		return this.goodsClientService.loadAllGoodsForSelect();
	}
	
	/**
	 *根据供应商ID查询商品信息 
	 */
	@RequestMapping("loadGoodsByProviderId")
	public DataGridView loadGoodsByProviderId(Integer providerid) {
		return this.goodsClientService.loadGoodsByProviderId(providerid);
	}
	/**
	 *根据供应商ID查询商品信息
	 */
	@RequestMapping("loadGoodsById")
	public DataGridView loadGoodsById() {
		return this.goodsClientService.loadGoodsById();
	}

	/**
	 * 根据商品id查询商品信息
	 *
	 */
	@RequestMapping(value = "getGoodsByGid")
	public DataGridView getGoodsByGid(Integer id) {
		return this.goodsClientService.getGoodsByGid(id);
	}
}
